.bx-button {
    --button-rgb: var(--bx-default-button-rgb);
    --button-hover-rgb: var(--bx-default-button-hover-rgb);
    --button-active-rgb: var(--bx-default-button-active-rgb);
    --button-disabled-rgb: var(--bx-default-button-disabled-rgb);

    background-color: unquote('rgb(var(--button-rgb))');
    user-select: none;
    -webkit-user-select: none;
    color: #fff;
    font-family: var(--bx-title-font-semibold);
    font-size: 14px;
    border: none;
    font-weight: 400;
    height: var(--bx-button-height);
    border-radius: 4px;
    padding: 0 8px;
    text-transform: uppercase;
    cursor: pointer;
    overflow: hidden;

    &:not([disabled]):active {
        background-color: unquote('rgb(var(--button-active-rgb))');
    }

    &:focus {
        outline: none !important;
    }

    &:not([disabled]):not(:active) {
        &:hover, &.bx-focusable:focus {
            background-color: unquote('rgb(var(--button-hover-rgb))');
        }
    }


    &:disabled {
        cursor: default;
        background-color: unquote('rgb(var(--button-disabled-rgb))');
        opacity: 0.5;
    }

    &.bx-ghost {
        background-color: transparent;

        &:not([disabled]):not(:active) {
            &:hover, &.bx-focusable:focus {
                background-color: unquote('rgb(var(--button-hover-rgb))');
            }
        }
    }

    &.bx-primary {
        --button-rgb: var(--bx-primary-button-rgb);

        &:not([disabled]):active {
            --button-active-rgb: var(--bx-primary-button-active-rgb);
        }

        &:not([disabled]):not(:active) {
            &:hover, &.bx-focusable:focus {
                --button-hover-rgb: var(--bx-primary-button-hover-rgb);
            }
        }

        &:disabled {
            --button-disabled-rgb: var(--bx-primary-button-disabled-rgb);
        }
    }

    &.bx-warning {
        --button-rgb: var(--bx-warning-button-rgb);

        &:not([disabled]):active {
            --button-active-rgb: var(--bx-warning-button-active-rgb);
        }

        &:not([disabled]):not(:active) {
            &:hover, &.bx-focusable:focus {
                --button-hover-rgb: var(--bx-warning-button-hover-rgb);
            }
        }

        &:disabled {
            --button-disabled-rgb: var(--bx-warning-button-disabled-rgb);
        }
    }

    &.bx-danger {
        --button-rgb: var(--bx-danger-button-rgb);

        &:not([disabled]):active {
            --button-active-rgb: var(--bx-danger-button-active-rgb);
        }

        &:not([disabled]):not(:active) {
            &:hover, &.bx-focusable:focus {
                --button-hover-rgb: var(--bx-danger-button-hover-rgb);
            }
        }

        &:disabled {
            --button-disabled-rgb: var(--bx-danger-button-disabled-rgb);
        }
    }

    &.bx-frosted {
        --button-alpha: 0.2;
        background-color: unquote('rgba(var(--button-rgb), var(--button-alpha))');

        &:not([disabled]):not(:active) {
            &:hover, &.bx-focusable:focus {
                background-color: unquote('rgba(var(--button-hover-rgb), var(--button-alpha))');
            }
        }
    }

    &.bx-drop-shadow {
        box-shadow: 0 0 4px #00000080;
    }

    &.bx-tall {
        height: calc(var(--bx-button-height) * 1.5) !important;
    }

    &.bx-circular {
        border-radius: var(--bx-button-height);
        width: var(--bx-button-height);
        height: var(--bx-button-height);
    }

    svg {
        display: inline-block;
        width: 16px;
        height: var(--bx-button-height);
    }

    span {
        display: inline-block;
        /* height: var(--bx-button-height); */
        line-height: var(--bx-button-height);
        vertical-align: middle;
        /* vertical-align: -webkit-baseline-middle; */
        color: #fff;
        overflow: hidden;
        white-space: nowrap;

        // Text with icon
        &:not(:only-child) {
            margin-inline-start: 8px;
        }
    }

    &.bx-button-multi-lines {
        height: auto;
        text-align: left;
        padding: 10px;

        span {
            line-height: unset;
            display: block;

            &:last-of-type {
                    text-transform: none;
                    font-weight: normal;
                    font-family: "Segoe Sans Variable Text";
                    font-size: 12px;
                    margin-top: 4px;
            }
        }
    }
}

.bx-focusable {
    position: relative;
    overflow: visible;

    &::after {
        border: 2px solid transparent;
        border-radius: 10px;
    }

    &:focus::after {
        offset = -6px;
        content: '';
        border-color: white;
        position: absolute;
        top: offset;
        left: offset;
        right: offset;
        bottom: offset;
    }

    html[data-active-input=touch] &,
    html[data-active-input=mouse] & {
        &:focus::after {
            border-color: transparent !important;
        }
    }

    &.bx-circular {
        &::after {
            border-radius: var(--bx-button-height);
        }
    }
}

a.bx-button {
    display: inline-block;

    &.bx-full-width {
        text-align: center;
    }
}

button.bx-inactive {
    pointer-events: none;
    opacity: 0.2;
    background: transparent !important;
}
